package com.zaoniao.enstudy.api.dto;

import com.zaoniao.enstudy.domain.entity.VocabularyWords;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import javax.validation.constraints.NotBlank;

@Data
@Schema(name = "词汇表单词收藏入参对象", description = "从客户端，由用户传入的数据封装在此entity中")
public class VocabularyWordsAddDto {

    /**
     * 单词。
     */
    @Schema(description = "单词", name = "word", example = "lesson")
    @NotBlank(message = "用户昵称不能为空")
    private String word;

    /**
     * 词汇表名称（可为空）
     */
    @Schema(description = "词汇表", name = "vocabularyId", example = "1")
    private Integer vocabularyId;

    /**
     * 词汇表名称（可为空）
     */
    @Schema(description = "用户id", name = "userId")
    private String userId;


    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter {

        VocabularyWordsAddDto.Converter INSTANCE = Mappers.getMapper(VocabularyWordsAddDto.Converter.class);

        VocabularyWords dto2do(VocabularyWordsAddDto vocabularyWordsAddDto);

    }
}
